package com.itheima.day15.TCP.test9;

import java.io.IOException;
import java.net.Socket;

public class ChatClientDemo3 {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.0.100", 10002);
       // Scanner sc = new Scanner(System.in);
//        while (true) {
//            BufferedWriter osw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
//            String s1 = sc.nextLine();
//            osw.write(s1);
//            osw.newLine();
//            osw.flush();
//            s.shutdownOutput();
//            System.out.println("发送成功,等待接受");
//            InputStreamReader isr = new InputStreamReader(s.getInputStream());
//            int b;
//            while ((b = isr.read()) != -1) {
//                System.out.print((char)b);
//            }
//        }
        ChatInput c1 = new ChatInput(s);
        ChatOutput c2 = new ChatOutput(s);
        Thread t1 = new Thread(c1);
        Thread t2 = new Thread(c2);
        t1.start();
        t2.start();

    }
}
